<script setup lang="ts">

import { ref } from 'vue';
import MyTable from '../day4/MyTable.vue';

const list = ref([
  { id: 1, name: '张小花', age: 18 },
  { id: 2, name: '孙大明', age: 19 },
  { id: 3, name: '刘德忠', age: 17 },
])


const onShowInfo =(item:any)=>{
  console.log(item)
}
</script>

<template>

 <div class="index-page">
 <MyTable :list="list">


  <template #default="obj">
    <tr>
      <td>{{ obj.item.id }}</td>
      <td>{{ obj.item.name }}</td>

      <td>{{ obj.item.age }}</td>

      <button @click="onShowInfo(obj.item)">查看</button>

    </tr>

  </template>
 </MyTable>

  </div>
 
</template>

<style scoped>

</style>
